<div id="content">
	<div class="row s_page_title">
		<sa-big-breadcrumbs [items]="['系统基础管理','资源管理']" icon="fa fa-list" class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>

	<sa-widgets-grid>
		<div class="s_table">
			<div sa-widget [editbutton]="false" color="darken" class="clearfix">
				<header><span class="widget-icon"> <i class="fa fa-table"></i> </span><h2>资源管理</h2></header>
				<div>
					<div class="widget-body no-padding">
						<div class="page-header clearfix s_table_opreation">
							<div class="left page-header-btn">
								<div class="top_module top_module_box">
									<span class="top_module_label module_text">资源类型</span>
									<select name="" class="top_module_select" [(ngModel)]="resourceType" (change)='table_search()'>
										<option value="">全部</option>
										<option *ngFor="let item of resourceTypeList" [value]='item.value'>{{item.label}}</option>
									</select>
								</div>
								<button  type="button"  class="btn btn-primary" (click)="new_resource('new')" *ngIf="resourceAdd">添加</button>
								<button  type="button"  class="btn btn-primary" (click)="menu_sort(resoureMenuModal)">菜单排序</button>
							</div>
							<div class="right top-search">
								<input type="text" [(ngModel)]="searchKey" (change)="table_search()" class="search-input" placeholder="资源名称...">
								<span class="top-search-box">
							        <button class="top-search-btn" type="button" (click)="table_search()"> <i class="fa fa-search"></i></button>
							    </span>
							</div>
						</div>
						<div class="table_scroll">
							<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
								<thead>
									<tr>
										<th>编号</th>
										<th>资源名称</th>
										<th>上级名称</th>
										<th>项目类型</th>
										<th>资源标识</th>
										<th>资源类型</th>
										<th>图标</th>
										<th>资源path</th>
										<th>创建时间</th>
										<th>资源排序</th>
										<th *ngIf="resourceEdit||resourceDeleteBatch">操作</th>
									</tr>
								</thead>
								<tbody>
									<tr *ngFor="let row of tableData" >
										<td>{{row.id}}</td>
										<td>{{row.name}}</td>
										<td>{{row.parentName}}</td>
										<td>
											<span *ngIf="row.resourceType === 0">默认</span>
					            			<span *ngIf="row.resourceType === 1">新汉德平台</span>
					            			<span *ngIf="row.resourceType === 2">供应链</span>
					            			<span *ngIf="row.resourceType === 3">商城</span>
										</td>
										<td>{{row.sourceKey}}</td>
										<td>
											<span *ngIf="row.type === 0" class="green">菜单</span>
					            			<span *ngIf="row.type === 1" class="orange">按钮</span>
										</td>
										<td>{{row.icon}}</td>
										<td>{{row.path}}</td>
										<td>{{row.createTime}}</td>
										<td>{{row.indexNum}}</td>
										<td *ngIf="resourceEdit||resourceDeleteBatch">
											<button type="button" (click)="updata_resource(row)" *ngIf="resourceEdit">编辑</button>
											<button type="button" (click)="del_resource(row)" *ngIf="resourceDeleteBatch">删除</button>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
						<div class="table-fix clearfix">
							<paginator [totalRecords]="totalCount"
						           [rows]="pageSize"
						           [currentPage]="curPage - 1"
						           (onPageChange)="paginate($event)">
							</paginator>
							<button type="button" class="btn default refresh_btn" (click)="refresh()"><i class="fa fa-refresh"></i></button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</sa-widgets-grid>
	<!--    弹窗 菜单排序-->
	<section bsModal #resoureMenuModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" (click)="modalClose(resoureMenuModal)" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title">菜单排序</h4>
				</div>
				<form id="resoureMenuFrom"  class="form-horizontal" role="form" novalidate="novalidate">
					<div class="modal-body" style="height: 600px;overflow-y: scroll;">
						<div class="row form-horizontal">
							<div class="col-xs-12">
								<div class="dd" id="nestable">
									<ul class="dd-list" id="nestableList"></ul>
								</div>
							</div>
							<!-- <sa-nestable-list [items]="" [options]="" (change)="menuSelect($event)"></sa-nestable-list>                  -->
	                   	</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" (click)="modalClose(resoureMenuModal)">取消</button>
						<button type="button" class="btn btn-primary" (click)="showMenu()">重置</button>
						<button type="button" class="btn btn-primary" (click)="menuControlSubmit(resoureMenuModal)">确认</button>
					</div>
				</form>
			</div>
		</div>
	</section>
	<!--  弹窗end-->
</div>